package com.ea.eadp.nexus.test.common;

import java.util.ArrayList;
import java.util.List;

public class AppClientFactory {
    
    private static List<AppClient> testClientList = new ArrayList<AppClient>();
    
    private AppClientFactory(){
        testClientList.add(new AppClient("ndc1", false, false, true));
        testClientList.add(new AppClient("ndc2", false, false, false));
        testClientList.add(new AppClient("ndc3", true, true, true));
        testClientList.add(new AppClient("ndc4", true, false, true));
        testClientList.add(new AppClient("ndc5", true, true, false));
        testClientList.add(new AppClient("ndc6", true, false, false));
    };
    private static AppClientFactory instance;
    
    public static synchronized AppClientFactory getInstance(){
        if(null == instance){
            instance = new AppClientFactory();
        }
        return instance;
    }
    
    public AppClient getAppClient(AppClient appClient){
        if(appClient == null) return null;
        for(AppClient client : testClientList){
            if(client.match(appClient)){
                return client;
            }
        }
        return null;    
    }
}
